package com.easygoods.dao;

import com.easygoods.base.BaseDao;
import com.easygoods.entity.MemberInfo;
import com.easygoods.response.AcpMemberResponse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by 许崇雷 on 2018-12-25.
 */
@Repository
public interface MemberInfoDao extends BaseDao<MemberInfo> {
    List<String> getMemberIdList(RowBounds rowBounds);

    //增加邀请代金券总金额
    int increaseInviteCoupon(@Param("memberId") String memberId, @Param("coupon") BigDecimal coupon);

    //用户首次购买时的返现，退货的时候cash可以为负数
    int increaseFirstInviteCash(@Param("memberId") String memberId, @Param("cash") BigDecimal cash);

    //用户非首次购买时的返现
    int increaseManyInviteCash(@Param("memberId") String memberId, @Param("cash") BigDecimal cash);

    //更新该用户历史总的商品可赚金额
    int increaseEarnCash(@Param("memberId") String memberId, @Param("cash") BigDecimal cash);

    //团队任务返现
    int increaseTeamCash(@Param("memberId") String memberId, @Param("cash") BigDecimal cash);

    //提现
    int decreaseCash(@Param("memberId") String memberId, @Param("cash") BigDecimal cash);

    //提现交易完成
    int finishDrawCash(@Param("drawCashId") String drawCashId, @Param("tradeNo") String tradeNo, @Param("tradeTime") Date tradeTime);

    //获取该用户邀请的用户
    List<AcpMemberResponse> getAcpMemberList(@Param("refMemberId") String refMemberId, @Param("registerTime") Date registerTime, RowBounds rowBounds);
}
